/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('jarvis-public', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateConsoleAccessWhiteListRequest {
  dstPort?: int32(name='DstPort'),
  instanceIdList?: string(name='InstanceIdList'),
  instanceInfoList?: string(name='InstanceInfoList'),
  lang?: string(name='Lang'),
  liveTime?: int32(name='LiveTime'),
  note?: string(name='Note'),
  productName?: string(name='ProductName'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  sourceCode?: string(name='SourceCode'),
  sourceIp?: string(name='SourceIp'),
  srcIP?: string(name='SrcIP'),
  whiteListType?: int32(name='WhiteListType'),
}

model CreateConsoleAccessWhiteListResponseBody = {
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model CreateConsoleAccessWhiteListResponse = {
  headers: map[string]string(name='headers'),
  body: CreateConsoleAccessWhiteListResponseBody(name='body'),
}

async function createConsoleAccessWhiteListWithOptions(request: CreateConsoleAccessWhiteListRequest, runtime: Util.RuntimeOptions): CreateConsoleAccessWhiteListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dstPort)) {
    query['DstPort'] = request.dstPort;
  }
  if (!Util.isUnset(request.instanceIdList)) {
    query['InstanceIdList'] = request.instanceIdList;
  }
  if (!Util.isUnset(request.instanceInfoList)) {
    query['InstanceInfoList'] = request.instanceInfoList;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.liveTime)) {
    query['LiveTime'] = request.liveTime;
  }
  if (!Util.isUnset(request.note)) {
    query['Note'] = request.note;
  }
  if (!Util.isUnset(request.productName)) {
    query['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['SourceCode'] = request.sourceCode;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.srcIP)) {
    query['SrcIP'] = request.srcIP;
  }
  if (!Util.isUnset(request.whiteListType)) {
    query['WhiteListType'] = request.whiteListType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateConsoleAccessWhiteList',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createConsoleAccessWhiteList(request: CreateConsoleAccessWhiteListRequest): CreateConsoleAccessWhiteListResponse {
  var runtime = new Util.RuntimeOptions{};
  return createConsoleAccessWhiteListWithOptions(request, runtime);
}

model DeleteConsoleAccessWhiteListRequest {
  disableWhitelist?: string(name='DisableWhitelist'),
  lang?: string(name='Lang'),
  sourceCode?: string(name='SourceCode'),
  sourceIp?: string(name='SourceIp'),
}

model DeleteConsoleAccessWhiteListResponseBody = {
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model DeleteConsoleAccessWhiteListResponse = {
  headers: map[string]string(name='headers'),
  body: DeleteConsoleAccessWhiteListResponseBody(name='body'),
}

async function deleteConsoleAccessWhiteListWithOptions(request: DeleteConsoleAccessWhiteListRequest, runtime: Util.RuntimeOptions): DeleteConsoleAccessWhiteListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.disableWhitelist)) {
    query['DisableWhitelist'] = request.disableWhitelist;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['SourceCode'] = request.sourceCode;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteConsoleAccessWhiteList',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteConsoleAccessWhiteList(request: DeleteConsoleAccessWhiteListRequest): DeleteConsoleAccessWhiteListResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteConsoleAccessWhiteListWithOptions(request, runtime);
}

model DescribeAccessWhiteListSlbListRequest {
  lang?: string(name='Lang'),
  sourceCode?: string(name='SourceCode'),
  sourceIp?: string(name='SourceIp'),
}

model DescribeAccessWhiteListSlbListResponseBody = {
  requestId?: string(name='RequestId'),
  slbList?: [ 
    {
      IP?: string(name='IP'),
      instanceId?: string(name='InstanceId'),
      instanceName?: string(name='InstanceName'),
      itemSign?: string(name='ItemSign'),
      region?: string(name='Region'),
    }
  ](name='SlbList'),
  totalCount?: int32(name='TotalCount'),
  module?: string(name='module'),
}

model DescribeAccessWhiteListSlbListResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAccessWhiteListSlbListResponseBody(name='body'),
}

async function describeAccessWhiteListSlbListWithOptions(request: DescribeAccessWhiteListSlbListRequest, runtime: Util.RuntimeOptions): DescribeAccessWhiteListSlbListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['SourceCode'] = request.sourceCode;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAccessWhiteListSlbList',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeAccessWhiteListSlbList(request: DescribeAccessWhiteListSlbListRequest): DescribeAccessWhiteListSlbListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAccessWhiteListSlbListWithOptions(request, runtime);
}

model DescribeAccessWhitelistEcsListRequest {
  lang?: string(name='Lang'),
  sourceCode?: string(name='SourceCode'),
  sourceIp?: string(name='SourceIp'),
}

model DescribeAccessWhitelistEcsListResponseBody = {
  ecsList?: [ 
    {
      IP?: string(name='IP'),
      instanceId?: string(name='InstanceId'),
      instanceName?: string(name='InstanceName'),
    }
  ](name='EcsList'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
  module?: string(name='module'),
}

model DescribeAccessWhitelistEcsListResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAccessWhitelistEcsListResponseBody(name='body'),
}

async function describeAccessWhitelistEcsListWithOptions(request: DescribeAccessWhitelistEcsListRequest, runtime: Util.RuntimeOptions): DescribeAccessWhitelistEcsListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['SourceCode'] = request.sourceCode;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAccessWhitelistEcsList',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeAccessWhitelistEcsList(request: DescribeAccessWhitelistEcsListRequest): DescribeAccessWhitelistEcsListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAccessWhitelistEcsListWithOptions(request, runtime);
}

model DescribeAttackEventRequest {
  currentPage?: int32(name='CurrentPage'),
  endTime?: int32(name='EndTime'),
  lang?: string(name='Lang'),
  pageSize?: int32(name='PageSize'),
  productType?: string(name='ProductType'),
  region?: string(name='Region'),
  serverIpList?: string(name='ServerIpList'),
  sourceIp?: string(name='SourceIp'),
  startTime?: int32(name='StartTime'),
}

model DescribeAttackEventResponseBody = {
  eventList?: [ 
    {
      attackType?: string(name='AttackType'),
      gmtCreate?: string(name='GmtCreate'),
      gmtCreateStamp?: int32(name='GmtCreateStamp'),
      gmtModified?: string(name='GmtModified'),
      sourceIp?: string(name='SourceIp'),
      url?: string(name='Url'),
      vmIp?: string(name='VmIp'),
    }
  ](name='EventList'),
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model DescribeAttackEventResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAttackEventResponseBody(name='body'),
}

async function describeAttackEventWithOptions(request: DescribeAttackEventRequest, runtime: Util.RuntimeOptions): DescribeAttackEventResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.serverIpList)) {
    query['ServerIpList'] = request.serverIpList;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAttackEvent',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeAttackEvent(request: DescribeAttackEventRequest): DescribeAttackEventResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAttackEventWithOptions(request, runtime);
}

model DescribeAttackedIpRequest {
  currentPage?: int32(name='CurrentPage'),
  endTime?: int32(name='EndTime'),
  lang?: string(name='Lang'),
  pageSize?: int32(name='PageSize'),
  productType?: string(name='ProductType'),
  region?: string(name='Region'),
  serverIpList?: string(name='ServerIpList'),
  sourceIp?: string(name='SourceIp'),
  startTime?: int32(name='StartTime'),
}

model DescribeAttackedIpResponseBody = {
  ipList?: [ string ](name='IpList'),
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model DescribeAttackedIpResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeAttackedIpResponseBody(name='body'),
}

async function describeAttackedIpWithOptions(request: DescribeAttackedIpRequest, runtime: Util.RuntimeOptions): DescribeAttackedIpResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.serverIpList)) {
    query['ServerIpList'] = request.serverIpList;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAttackedIp',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeAttackedIp(request: DescribeAttackedIpRequest): DescribeAttackedIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAttackedIpWithOptions(request, runtime);
}

model DescribeConsoleAccessWhiteListRequest {
  currentPage?: int32(name='CurrentPage'),
  dstIP?: string(name='DstIP'),
  lang?: string(name='Lang'),
  pageSize?: int32(name='PageSize'),
  sourceCode?: string(name='SourceCode'),
  sourceIp?: string(name='SourceIp'),
  srcIP?: string(name='SrcIP'),
  status?: string(name='Status'),
  whiteListType?: int32(name='WhiteListType'),
  queryProduct?: string(name='queryProduct'),
}

model DescribeConsoleAccessWhiteListResponseBody = {
  dataList?: [ 
    {
      dstIp?: string(name='DstIp'),
      gmtCreate?: string(name='GmtCreate'),
      gmtRealExpire?: string(name='GmtRealExpire'),
      id?: int32(name='Id'),
      insProduct?: string(name='InsProduct'),
      regionId?: string(name='RegionId'),
      srcIp?: string(name='SrcIp'),
      status?: string(name='Status'),
    }
  ](name='DataList'),
  pageInfo?: {
    currentPage?: int32(name='currentPage'),
    pageSize?: int32(name='pageSize'),
    total?: int32(name='total'),
  }(name='PageInfo'),
  requestId?: string(name='RequestId'),
  module?: string(name='module'),
}

model DescribeConsoleAccessWhiteListResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeConsoleAccessWhiteListResponseBody(name='body'),
}

async function describeConsoleAccessWhiteListWithOptions(request: DescribeConsoleAccessWhiteListRequest, runtime: Util.RuntimeOptions): DescribeConsoleAccessWhiteListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.dstIP)) {
    query['DstIP'] = request.dstIP;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['SourceCode'] = request.sourceCode;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.srcIP)) {
    query['SrcIP'] = request.srcIP;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.whiteListType)) {
    query['WhiteListType'] = request.whiteListType;
  }
  if (!Util.isUnset(request.queryProduct)) {
    query['queryProduct'] = request.queryProduct;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeConsoleAccessWhiteList',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeConsoleAccessWhiteList(request: DescribeConsoleAccessWhiteListRequest): DescribeConsoleAccessWhiteListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeConsoleAccessWhiteListWithOptions(request, runtime);
}

model DescribeCountAttackEventRequest {
  currentPage?: int32(name='CurrentPage'),
  endTime?: int32(name='EndTime'),
  lang?: string(name='Lang'),
  pageSize?: int32(name='PageSize'),
  productType?: string(name='ProductType'),
  region?: string(name='Region'),
  serverIpList?: string(name='ServerIpList'),
  sourceIp?: string(name='SourceIp'),
  startTime?: int32(name='StartTime'),
}

model DescribeCountAttackEventResponseBody = {
  count?: long(name='Count'),
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
}

model DescribeCountAttackEventResponse = {
  headers: map[string]string(name='headers'),
  body: DescribeCountAttackEventResponseBody(name='body'),
}

async function describeCountAttackEventWithOptions(request: DescribeCountAttackEventRequest, runtime: Util.RuntimeOptions): DescribeCountAttackEventResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.productType)) {
    query['ProductType'] = request.productType;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.serverIpList)) {
    query['ServerIpList'] = request.serverIpList;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCountAttackEvent',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeCountAttackEvent(request: DescribeCountAttackEventRequest): DescribeCountAttackEventResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCountAttackEventWithOptions(request, runtime);
}

model DescribePhoneInfoRequest {
  lang?: string(name='Lang'),
  sourceIp?: string(name='SourceIp'),
  phoneNum?: string(name='phoneNum'),
  sourceCode?: string(name='sourceCode'),
}

model DescribePhoneInfoResponseBody = {
  module?: string(name='Module'),
  requestId?: string(name='RequestId'),
  detectTime?: string(name='detectTime'),
  phoneNum?: long(name='phoneNum'),
  riskLevel?: long(name='riskLevel'),
}

model DescribePhoneInfoResponse = {
  headers: map[string]string(name='headers'),
  body: DescribePhoneInfoResponseBody(name='body'),
}

async function describePhoneInfoWithOptions(request: DescribePhoneInfoRequest, runtime: Util.RuntimeOptions): DescribePhoneInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  if (!Util.isUnset(request.phoneNum)) {
    query['phoneNum'] = request.phoneNum;
  }
  if (!Util.isUnset(request.sourceCode)) {
    query['sourceCode'] = request.sourceCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribePhoneInfo',
    version = '2018-06-21',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describePhoneInfo(request: DescribePhoneInfoRequest): DescribePhoneInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePhoneInfoWithOptions(request, runtime);
}

